home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / GraphicsWrap / Source / NXBitmapGraphicRep.h < prev    next >
Text File  |  1991-09-17  |  3KB  |  82 lines

  1. /* NXBitmapGraphicRep.h -- The meaty part of the front end.
  2.  *
  3.  * Written By: Bill Bumgarner (Friday Software & Consulting)
  4.  *             <wb1j+@andrew.cmu.edu>
  5.  *             414 S.Craig, #119
  6.  *             Pittsburgh, PA. 15213
  7.  *             412-268-5378
  8.  *
  9.  * <see NXBitmapGraphicRep.m for notes>
  10.  */
  11.  
  12. #import <appkit/NXBitmapImageRep.h>
  13. #import <appkit/color.h>
  14.  
  15. @interface NXBitmapGraphicRep : NXBitmapImageRep
  16. {
  17.   long num_bytes;      // number of bytes in entire image
  18.   long bytes_per_row;  // bytes per single scan line
  19.   unsigned char *data; // pointer to the actual bitmap data
  20.  
  21.   NXColor foreColor;
  22.   NXColor backColor;
  23.   unsigned char cur_red, cur_grn, cur_blu;
  24.   unsigned char bck_red, bck_grn, bck_blu;
  25.   unsigned char gray_level;
  26.   unsigned char bck_gray_level;
  27.  
  28.   int yh; // pixelsHigh-1 -- used in the calculation of the offset
  29.           // into data to auto-flip the image.
  30.   int imageDepth;
  31. }
  32. // used to initialize the bitmap w/a certain size and color model with the
  33. // background color set to c
  34. - initWithSize:(NXSize *) aSize depth:(int) aDepth andColor:(NXColor)c;
  35.  
  36. // calls above with c=NX_COLORBLACK to force a black background
  37. - initWithSize:(NXSize *) aSize andDepth:(int) aDepth;
  38.  
  39. // erases the current frame to aColor
  40. - eraseFrameToColor:(NXColor) aColor;
  41. // erases the current frame to backColor
  42. - eraseFrame;
  43.  
  44. // plots points in the current foreColor and erases points to the current
  45. // backColor.  WATCHOUT:  both these routines do some nasty bit level
  46. // manipulation in the twelve bit and two bit modes.
  47. - plotPoint:(long)x :(long)y;
  48. - erasePoint:(long)x :(long)y;
  49.  
  50. /* sets the background and foreground color.  In two bit and twelve
  51.  * bit mode, the color model stays in the full NXColor structure--
  52.  * only the pixels that are put on screen drop back to the lower bit model.
  53.  * NXColor structure is defined as:
  54.  * typedef struct _NXColor {
  55.  *  unsigned short colorField[8];
  56.  *  } NXColor;
  57.  * Because of this, this object is completely compatible with RGB,
  58.  * HSB, and CMYK color models.  To appropriately set the various
  59.  * values of the structure, use the various methods defined in
  60.  * /usr/include/appkit/color.h
  61.  * (Look in digital libararian for more information */
  62. - setColor:(NXColor) aColor;
  63. - setBackColor:(NXColor) aColor;
  64.  
  65. /* returns the current color or current backColor of the image */
  66. - (NXColor)color;
  67. - (NXColor)backColor;
  68.  
  69. /* returns the current depth of the color model being used. */
  70. - (int)imageDepth;
  71.  
  72. // ASSIGNMENT #1 line drawing routine.
  73. - line:(int)x0 :(int)y0 :(int)x1 :(int)y1;
  74. - cmdDraw:(int)x :(int)y;
  75. - cmdMove:(int)x :(int)y;
  76. - cmdCircle:(int)r;
  77. - cmdFps:(int)f;
  78. - cmdHold:(int)seconds;
  79. - cmdNewframe;
  80. - cmdDrawPoly:vertexList;
  81. @end
  82.